﻿using System;
using Castle.ActiveRecord;
using CosyTrade.Data;
using CosyTrade.Organization;

namespace CosyTrade.Store
{
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [ActiveRecord("tabCompanyStore"), Serializable]
    public class CompanyStore : BusinessObject
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        private Company company;
        private Product products;
        private int storeCount;
        private int bookCount;

        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access = PropertyAccess.NosetterCamelcase)]
        public override Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        [BelongsTo("CompanyGuid")]
        public Company Company
        {
            get { return company; }
            set { company = value; }
        }

        [BelongsTo("ProductGuid")]
        public Product Products
        {
            get { return products; }
            set { products = value; }
        }

        /// <summary>
        /// �ܿ��
        /// </summary>
        [Property]
        public int StoreCount
        {
            get { return storeCount; }
            set { storeCount = value; }
        }

        /// <summary>
        /// �ѱ�������Ʒ���� 
        /// </summary>
        [Property]
        public int BookCount
        {
            get { return bookCount; }
            set { bookCount = value; }
        }
    }
}